package com.demo;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author mwl 2018-10-11
 * <p>
 * </p>
 **/
public class Main {
    public static void main(String[] args) {

        String tmp = " /**\n 1个人账/户详情\n*/\n* public (/**\n 1个人账户详情2\n*/nn public ( sdlfajsdl";

        String tmp2 = "/**\\n 2个人账/户详情\\n*/ll public (/**\\n 2个人账/户详情2\\n*/sdlfajsdl\"public (";
        Pattern p = Pattern.compile("/\\*{1,2}.*?\\*/[^**]+?public[^{]+?\\(");
        //            Pattern p = Pattern.compile("/\\*{1,2}.*(?!\\*/)\\*/[^**]+?public[^{]+?\\(");

        List<String> list = new ArrayList<>();
        list.add(tmp);
        list.add(tmp2);
        for (String str : list) {
            System.out.println("-------------------------------");
            Matcher m = p.matcher(str);
            while (m.find()) {
                System.out.println("-------------序号------------------");
                System.out.println(m.group());
            }
        }


    }
}
